package cn.calm.swing.osgi.persistence;

import org.osgi.framework.BundleActivator;
import org.osgi.framework.BundleContext;
import org.osgi.framework.ServiceRegistration;

import cn.calm.swing.osgi.api.ProjectPersistenceService;
import cn.calm.swing.osgi.persistence.impl.ProjectPersistenceServiceImpl;

public class Activator implements BundleActivator{
	private ServiceRegistration<ProjectPersistenceService> registerService;
	@Override
	public void start(BundleContext context) throws Exception {
		ProjectPersistenceService persistenceService=new ProjectPersistenceServiceImpl();
		registerService = context.registerService(ProjectPersistenceService.class, persistenceService, null);
	}

	@Override
	public void stop(BundleContext context) throws Exception {
		if(registerService!=null){
			registerService.unregister();
		}
	}
}
